<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('数据列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>入库时间：</label>
                                <input type="text" name="originCreateTime" id="originCreateTime" width="400px" placeholder="选择时间"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "special/agency/data";

        var datagrantFlag = [[${@permission.hasPermi('special:agency:datagrant')}]];

        $(function() {
            var options = {
                url: prefix + "/dataListInfo",
                updateUrl: prefix + "/dataEdit/{id}",
                modalName: "数据列表",
                columns: [
                 /*   {
                        field: 'id',
                        title: '数据ID'
                    },*/
                    // {
                    //     field: 'uid',
                    //     title: '用户ID'
                    // },
                {
                    field: '',
                    title: '详情',
                    formatter: function (value,row,index){
                        var result = '<span style="color: #1c84c6; border-bottom: 1px solid" onclick="memberInfoView(\''+row.uid+'\')">详情</span>';
                        return result;
                    }
                },
                {
                    field: 'username',
                    title: '个人信息',
                    formatter: function (value,row,index){
                        return row.username + '-' + row.age + '-' + row.sex;
                    }
                },
                {
                    field: 'province',
                    title: '省市',
                    formatter: function (value,row,index){
                        return row.province + '-' + row.city;
                    }
                },
                {
                    field: 'zhimaScore',
                    title: '芝麻分数'
                },
                {
                    field: 'huabei',
                    title: '花呗'
                },
                {
                    field: 'baitiao',
                    title: '白条'
                },
                {
                    field: 'house',
                    title: '房产情况'
                },
                {
                    field: 'car',
                    title: '车辆情况'
                },
                {
                    field: 'gjj',
                    title: '公积金'
                },
                {
                    field: 'adminUsername',
                    title: '成员'
                },
                {
                    field: 'feedbackInfo',
                    title: '客户跟踪'
                    // ,
                    // formatter: function(value, row, index) {
                    //     return $.table.tooltip(value);
                    // }
                },
                {
                    field: 'createTime',
                    title: '入库时间'
                },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function(value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-primary btn-xs '+datagrantFlag+'" href="javascript:void(0)" onclick="dataGrant(\'' + row.id + '\')"><i class="fa fa-desktop"></i>分配</a> ');
                            actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\', \'' + row.adminUserId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            return actions.join('');
                        }
                    }
                ]
            };
            $.table.init(options);

            layui.use('laydate', function(){
                var laydate = layui.laydate;

                laydate.render({
                    elem: '#originCreateTime',
                    type: 'datetime',
                    range: '~'
                });

            });
        });

        function memberInfoView(uid){
            var url = prefix + '/dataView/' + uid;
            $.modal.openTab('用户详情', url);
        }

        function dataGrant(dataId, userId){
            var url = prefix + '/dataGrant?dataId=' + dataId + '&userId=' + userId;
            $.modal.open('数据分配', url);
        }

    </script>
</body>
</html>